<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE HTML>
<html>
  <head>
    <title>天安财险</title>
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
    
    <script type="text/javascript">
	    $(function() {
			$("#username").focus();
			$("#inputForm").validate({
				rules: {
					username: {remote: "${ctx}/checkLoginName?oldLoginName=" + encodeURIComponent('${item.username}')}
				},
				messages: {
					username: {remote: "用户登录名已存在"},
				},
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
    </script>
    
  </head>
  
  <body>
  	<ul class="nav nav-tabs">
		<li><a href="${ctx}/user/list">用户列表</a></li>
		<li class="active"><a href="javascript:void(0);">用户${not empty user.id ? '修改' : '添加'}</a></li>
	</ul>
	
    <form:form modelAttribute="item" id="inputForm" cssClass="form-horizontal" action="${ctx}/user/save" method="post">
    	<sys:msg msgObj="${msg}" />
		<form:hidden path="id" />
		<div class="control-group">
			<label class="control-label">所属公司:</label>
			<div class="controls">
				<form:input path="orgid"  readonly="true" />
				<span class="help-inline"><span style="color:red">*</span> </span>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label">登陆名:</label>
			<div class="controls">
				<input id="oldLoginName" name="oldLoginName" type="hidden" value="${user.username}">
				<form:input path="username" cssClass="required" maxlength="50" />
				<span class="help-inline"><span style="color:red">*</span> </span>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label">真实姓名:</label>
			<div class="controls">
				<form:input path="userrealname" cssClass="required" maxlength="50" />
				<span class="help-inline"><span style="color:red">*</span> </span>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label">部门编号:</label>
			<div class="controls">
				<form:input path="departid" cssClass="required" maxlength="50" />
				<span class="help-inline"><span style="color:red">*</span> </span>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label">电话:</label>
			<div class="controls">
				<form:input path="mobilephone" cssClass="required number" maxlength="30" />
				<span class="help-inline"><span style="color:red">*</span> </span>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label">备注:</label>
			<div class="controls">
				<form:textarea path="remark" cssClass="input-xlarge"  maxlength="200" rows="3" />
			</div>
		</div>

		<div class="form-actions">
			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
    
  </body>
</html>
